package com.hue.springbootvalidation.controller;

import com.hue.springbootvalidation.domain.Order;
import com.hue.springbootvalidation.utils.R;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: yfq
 * @Date: 2022/8/4 15:53
 * @Description:
 */
@RestController
@RequestMapping("/order")
public class OrderController {
    //测试SaveOrder分组
    @PostMapping("/save")
    public R save(@RequestBody @Validated(Order.SaveOrder.class) Order order) {
        System.out.println(order);
        return R.ok();
    }

    //测试UpdateOrder分组
    @PutMapping("/update")
    public R update(@RequestBody @Validated(Order.UpdateOrder.class) Order order) {
        System.out.println(order);
        return R.ok();
    }
}
